import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/member/login',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/member/register',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/member/info',
    method: 'get',
    params: { token }
  })
}


export function detail(token) {
  return request({
    url: '/member/detail',
    method: 'get',
    params: { token }
  })
}
export function update(data) {
  return request({
    url: '/member/update',
    method: 'put',
    data
  })
}

export function logout() {
  return request({
    url: '/member/logout',
    method: 'post'
  })
}

export function upload(file) {
  const formData = new FormData()
  formData.append('file', file)
  return request({
    url: '/upload',
    method: 'post',
    data: formData
  })
}
